<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="jquery/jquery1.9/jquery-1.9.0.js"></script>
    <style>
        input{
            width:13px;
        }
        span{
            display: inline-block;
        }
    </style>
    <script>
        $(function(){
            $("#add").click(function(){
                var num=$("#result").val()*1;//获取当前值
                num=num+1;
                $("#result").val(num);

            });
            $("#minus").click(function(){
                var num=$("#result").val()*1;//获取当前值
                if(num>0){
                    num=num-1;
                }else{
                    alert("你不能再减了啊");
                }
                $("#result").val(num);

            });
        });
    </script>
</head>
<body>
    <span id="minus">-</span><input type="text" id="result" value="0"><span id="add">+</span>
</body>
</html>